
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>动画（Animations） · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="states_and_transitions.html" />
    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../meet_qt_5/">
            
                <a href="../meet_qt_5/">
            
                    
                    Qt5概述
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../meet_qt_5/preface.html">
            
                <a href="../meet_qt_5/preface.html">
            
                    
                    序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../meet_qt_5/qt5_introduction.html">
            
                <a href="../meet_qt_5/qt5_introduction.html">
            
                    
                    Qt5介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../meet_qt_5/qt_building_blocks.html">
            
                <a href="../meet_qt_5/qt_building_blocks.html">
            
                    
                    Qt构建模块（Qt Building Blocks）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../meet_qt_5/qt_project.html">
            
                <a href="../meet_qt_5/qt_project.html">
            
                    
                    Qt项目（Qt Project）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../get_start/">
            
                <a href="../get_start/">
            
                    
                    开始学习（Get Start）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../get_start/qt5installing_qt_5_sdk.html">
            
                <a href="../get_start/qt5installing_qt_5_sdk.html">
            
                    
                    安装Qt5软件工具包（Installing Qt 5 SDK）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../get_start/hello_world.html">
            
                <a href="../get_start/hello_world.html">
            
                    
                    你好世界（Hello World）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../get_start/application_types.html">
            
                <a href="../get_start/application_types.html">
            
                    
                    应用程序类型（Application Types）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../get_start/summary.html">
            
                <a href="../get_start/summary.html">
            
                    
                    总结（ Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../qt_creator_ide/">
            
                <a href="../qt_creator_ide/">
            
                    
                    Qt Creator集成开发环境（Qt Creator IDE）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../qt_creator_ide/the_user_interface.html">
            
                <a href="../qt_creator_ide/the_user_interface.html">
            
                    
                    用户界面（The User Interface）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../qt_creator_ide/qtregistering_your_qt_kit.html">
            
                <a href="../qt_creator_ide/qtregistering_your_qt_kit.html">
            
                    
                    注册你的Qt工具箱（Registering your Qt Kit）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../qt_creator_ide/managing_projects.html">
            
                <a href="../qt_creator_ide/managing_projects.html">
            
                    
                    项目管理（Managing Projects）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../qt_creator_ide/using_the_editor.html">
            
                <a href="../qt_creator_ide/using_the_editor.html">
            
                    
                    使用编辑器（Using the Editor）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../qt_creator_ide/locator.html">
            
                <a href="../qt_creator_ide/locator.html">
            
                    
                    定位器（Locator）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../qt_creator_ide/debugging.html">
            
                <a href="../qt_creator_ide/debugging.html">
            
                    
                    调试（Debugging）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../qt_creator_ide/shortcuts.html">
            
                <a href="../qt_creator_ide/shortcuts.html">
            
                    
                    快捷键（Shortcuts）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../quick_starter/">
            
                <a href="../quick_starter/">
            
                    
                    QML快速入门（Quick Starter）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../quick_starter/qmlqml_syntax.html">
            
                <a href="../quick_starter/qmlqml_syntax.html">
            
                    
                    QML语法（QML Syntax）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../quick_starter/basic_elements.html">
            
                <a href="../quick_starter/basic_elements.html">
            
                    
                    基本元素（Basic Elements）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../quick_starter/compontents.html">
            
                <a href="../quick_starter/compontents.html">
            
                    
                    组件（Compontents）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../quick_starter/simple_transformations.html">
            
                <a href="../quick_starter/simple_transformations.html">
            
                    
                    简单的转换（Simple Transformations）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../quick_starter/positioning_element.html">
            
                <a href="../quick_starter/positioning_element.html">
            
                    
                    定位元素（Positioning Element）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../quick_starter/layout_items.html">
            
                <a href="../quick_starter/layout_items.html">
            
                    
                    布局元素（Layout Items）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../quick_starter/input_element.html">
            
                <a href="../quick_starter/input_element.html">
            
                    
                    输入元素（Input Element）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../quick_starter/advanced_techniques.html">
            
                <a href="../quick_starter/advanced_techniques.html">
            
                    
                     高级用法（Advanced Techniques）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="./">
            
                <a href="./">
            
                    
                    动态元素（Fluid Elements）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.6.1" data-path="animations.html">
            
                <a href="animations.html">
            
                    
                    动画（Animations）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="states_and_transitions.html">
            
                <a href="states_and_transitions.html">
            
                    
                    状态与过渡（States and Transitions）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="advanced_techniques.html">
            
                <a href="advanced_techniques.html">
            
                    
                    高级用法（Advanced Techniques）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../model-view-delegate/">
            
                <a href="../model-view-delegate/">
            
                    
                    模型-视图-代理（Model-View-Delegate）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../model-view-delegate/concept.html">
            
                <a href="../model-view-delegate/concept.html">
            
                    
                    概念（Concept）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../model-view-delegate/basic_model.html">
            
                <a href="../model-view-delegate/basic_model.html">
            
                    
                    基础模型（Basic Model）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../model-view-delegate/dynamic_views.html">
            
                <a href="../model-view-delegate/dynamic_views.html">
            
                    
                    动态视图（Dynamic Views）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../model-view-delegate/delegate.html">
            
                <a href="../model-view-delegate/delegate.html">
            
                    
                    代理（Delegate）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../model-view-delegate/advanced_techniques.html">
            
                <a href="../model-view-delegate/advanced_techniques.html">
            
                    
                    高级用法（Advanced Techniques）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../model-view-delegate/summary.html">
            
                <a href="../model-view-delegate/summary.html">
            
                    
                    总结（Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../canvas_element/">
            
                <a href="../canvas_element/">
            
                    
                    画布元素（Canvas Element）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../canvas_element/convenient_api.html">
            
                <a href="../canvas_element/convenient_api.html">
            
                    
                    便捷的接口（Convenient API）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../canvas_element/gradients.html">
            
                <a href="../canvas_element/gradients.html">
            
                    
                    渐变（Gradients）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../canvas_element/shadows.html">
            
                <a href="../canvas_element/shadows.html">
            
                    
                    阴影（Shadows）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../canvas_element/images.html">
            
                <a href="../canvas_element/images.html">
            
                    
                    图片（Images）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../canvas_element/transformation.html">
            
                <a href="../canvas_element/transformation.html">
            
                    
                    转换（Transformation）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../canvas_element/composition_mode.html">
            
                <a href="../canvas_element/composition_mode.html">
            
                    
                    组合模式（Composition Mode）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../canvas_element/pixels_buffer.html">
            
                <a href="../canvas_element/pixels_buffer.html">
            
                    
                    像素缓冲（Pixels Buffer）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../canvas_element/canvas_paint.html">
            
                <a href="../canvas_element/canvas_paint.html">
            
                    
                    画布绘制（Canvas Paint）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../canvas_element/html5porting_from_html5_canvas.html">
            
                <a href="../canvas_element/html5porting_from_html5_canvas.html">
            
                    
                    HTML5画布移植（Porting from HTML5 Canvas）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../particle_simulations/">
            
                <a href="../particle_simulations/">
            
                    
                    粒子模拟（Particle Simulations）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../particle_simulations/concept.html">
            
                <a href="../particle_simulations/concept.html">
            
                    
                    概念（Concept）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../particle_simulations/simple_simulation.html">
            
                <a href="../particle_simulations/simple_simulation.html">
            
                    
                    简单的模拟（Simple Simulation）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../particle_simulations/particle_parameters.html">
            
                <a href="../particle_simulations/particle_parameters.html">
            
                    
                    粒子参数（Particle Parameters）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../particle_simulations/directed_particle.html">
            
                <a href="../particle_simulations/directed_particle.html">
            
                    
                    粒子方向（Directed Particle）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../particle_simulations/particle_painter.html">
            
                <a href="../particle_simulations/particle_painter.html">
            
                    
                    粒子画笔（Particle Painter）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" data-path="../particle_simulations/affecting_particles.html">
            
                <a href="../particle_simulations/affecting_particles.html">
            
                    
                    粒子控制（Affecting Particles）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.7" data-path="../particle_simulations/particle_group.html">
            
                <a href="../particle_simulations/particle_group.html">
            
                    
                    粒子组（Particle Group）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.8" data-path="../particle_simulations/summary.html">
            
                <a href="../particle_simulations/summary.html">
            
                    
                    总结（Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../shader_effect/">
            
                <a href="../shader_effect/">
            
                    
                    着色器效果（Shader Effect）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../shader_effect/openglopengl_shader.html">
            
                <a href="../shader_effect/openglopengl_shader.html">
            
                    
                    OpenGL着色器（OpenGL Shader）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../shader_effect/shader_elements.html">
            
                <a href="../shader_effect/shader_elements.html">
            
                    
                    着色器元素（Shader Elements）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../shader_effect/fragement_shader.html">
            
                <a href="../shader_effect/fragement_shader.html">
            
                    
                    片段着色器（Fragement Shader）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../shader_effect/wave_effect.html">
            
                <a href="../shader_effect/wave_effect.html">
            
                    
                    波浪效果（Wave Effect）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../shader_effect/vertex_shader.html">
            
                <a href="../shader_effect/vertex_shader.html">
            
                    
                    顶点着色器（Vertex Shader）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../shader_effect/curtain_effect.html">
            
                <a href="../shader_effect/curtain_effect.html">
            
                    
                    剧幕效果（Curtain Effect）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../shader_effect/qtqt_graphicseffect_library.html">
            
                <a href="../shader_effect/qtqt_graphicseffect_library.html">
            
                    
                    Qt图像效果库（Qt GraphicsEffect Library）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../multimedia/">
            
                <a href="../multimedia/">
            
                    
                    多媒体（Multimedia）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../multimedia/playing_media.html">
            
                <a href="../multimedia/playing_media.html">
            
                    
                    媒体播放（Playing Media）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../multimedia/sounds_effects.html">
            
                <a href="../multimedia/sounds_effects.html">
            
                    
                    声音效果（Sounds Effects）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../multimedia/video_streams.html">
            
                <a href="../multimedia/video_streams.html">
            
                    
                    视频流（Video Streams）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../multimedia/capturing_images.html">
            
                <a href="../multimedia/capturing_images.html">
            
                    
                    捕捉图像（Capturing Images）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../multimedia/advanced_techniques.html">
            
                <a href="../multimedia/advanced_techniques.html">
            
                    
                    高级用法（Advanced Techniques）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.6" data-path="../multimedia/summary.html">
            
                <a href="../multimedia/summary.html">
            
                    
                    总结（Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../networking/">
            
                <a href="../networking/">
            
                    
                    网络（Networking）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../networking/httpuiserving_ui_via_http.html">
            
                <a href="../networking/httpuiserving_ui_via_http.html">
            
                    
                    通过HTTP服务UI（Serving UI via HTTP）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../networking/templating.html">
            
                <a href="../networking/templating.html">
            
                    
                    模板（Templating）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../networking/httphttp_requests.html">
            
                <a href="../networking/httphttp_requests.html">
            
                    
                    HTTP请求（HTTP Requests）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../networking/local_files.html">
            
                <a href="../networking/local_files.html">
            
                    
                    本地文件（Local files）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../networking/restrest_api.html">
            
                <a href="../networking/restrest_api.html">
            
                    
                    REST接口（REST API）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../networking/authentication_using_oauth.html">
            
                <a href="../networking/authentication_using_oauth.html">
            
                    
                    使用开放授权登陆验证（Authentication using OAuth）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../networking/engine_io.html">
            
                <a href="../networking/engine_io.html">
            
                    
                    云服务（Engine IO）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.8" data-path="../networking/web_sockets.html">
            
                <a href="../networking/web_sockets.html">
            
                    
                    Web Sockets
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.9" data-path="../networking/summary.html">
            
                <a href="../networking/summary.html">
            
                    
                    总结（Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../storage/">
            
                <a href="../storage/">
            
                    
                    存储（Storage）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../storage/settings.html">
            
                <a href="../storage/settings.html">
            
                    
                    配置（Settings）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../storage/local_storage_-_sql.html">
            
                <a href="../storage/local_storage_-_sql.html">
            
                    
                    本地存储 - SQL（Local Storage - SQL）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../storage/other_storage_apis.html">
            
                <a href="../storage/other_storage_apis.html">
            
                    
                    其它存储接口（Other Storage APIs）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../dynamic_qml/">
            
                <a href="../dynamic_qml/">
            
                    
                    动态QML（Dynamic QML）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../dynamic_qml/loading_components_dynamically.html">
            
                <a href="../dynamic_qml/loading_components_dynamically.html">
            
                    
                    动态加载组件（Loading Components Dynamically）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1.1" data-path="../dynamic_qml/connecting_indirectly.html">
            
                <a href="../dynamic_qml/connecting_indirectly.html">
            
                    
                    间接连接（Connecting Indirectly）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.1.2" data-path="../dynamic_qml/binding_indirectly.html">
            
                <a href="../dynamic_qml/binding_indirectly.html">
            
                    
                    间接绑定（Binding Indirectly）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../dynamic_qml/creating_and_destroying_objects.html">
            
                <a href="../dynamic_qml/creating_and_destroying_objects.html">
            
                    
                    创建与销毁对象（Creating and Destroying Objects）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.2.1" data-path="../dynamic_qml/dynamically_loading_and_instantiating_items.html">
            
                <a href="../dynamic_qml/dynamically_loading_and_instantiating_items.html">
            
                    
                    动态加载和实例化项（Dynamically Loading and Instantiating Items）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2.2" data-path="../dynamic_qml/dynamically_instantiating_items_from_text.html">
            
                <a href="../dynamic_qml/dynamically_instantiating_items_from_text.html">
            
                    
                    从文本中动态实例化项（Dynamically Instantiating Items from Text）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2.3" data-path="../dynamic_qml/managing_dynamically_created_elements.html">
            
                <a href="../dynamic_qml/managing_dynamically_created_elements.html">
            
                    
                    管理动态创建的元素（Managing Dynamically Created Elements）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../dynamic_qml/tracking_dynamic_objects.html">
            
                <a href="../dynamic_qml/tracking_dynamic_objects.html">
            
                    
                    跟踪动态对象（Tracking Dynamic Objects）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.4" data-path="../dynamic_qml/summary.html">
            
                <a href="../dynamic_qml/summary.html">
            
                    
                    总结（Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../javascript/">
            
                <a href="../javascript/">
            
                    
                    JavaScript
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../javascript/browserhtml_vs_qtquickqml.html">
            
                <a href="../javascript/browserhtml_vs_qtquickqml.html">
            
                    
                    浏览器/HTML与QtQuick/QML对比（Browser/HTML vs QtQuick/QML）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../javascript/the_language.html">
            
                <a href="../javascript/the_language.html">
            
                    
                    JavaScript语法（The Language）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../javascript/js_objects.html">
            
                <a href="../javascript/js_objects.html">
            
                    
                    JS对象（JS Objects）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../javascript/creating_a_js_console.html">
            
                <a href="../javascript/creating_a_js_console.html">
            
                    
                    创建JS控制台（Creating a JS Console）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../qt_and_c++/">
            
                <a href="../qt_and_c++/">
            
                    
                    Qt and C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../qt_and_c++/a_boilerplate_application.html">
            
                <a href="../qt_and_c++/a_boilerplate_application.html">
            
                    
                    演示程序（A Boilerplate Application）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../qt_and_c++/the_qobject.html">
            
                <a href="../qt_and_c++/the_qobject.html">
            
                    
                    Qt对象（The QObject）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" data-path="../qt_and_c++/build_systems.html">
            
                <a href="../qt_and_c++/build_systems.html">
            
                    
                    编译系统（Build Systems）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.3.1" data-path="../qt_and_c++/qmake.html">
            
                <a href="../qt_and_c++/qmake.html">
            
                    
                    QMake
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3.2" data-path="../qt_and_c++/cmake.html">
            
                <a href="../qt_and_c++/cmake.html">
            
                    
                    CMake
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16.4" data-path="../qt_and_c++/common_qt_classes.html">
            
                <a href="../qt_and_c++/common_qt_classes.html">
            
                    
                    Qt通用类（Common Qt Classes）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.4.1" data-path="../qt_and_c++/qstring.html">
            
                <a href="../qt_and_c++/qstring.html">
            
                    
                    QString
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4.2" data-path="../qt_and_c++/sequential_containers.html">
            
                <a href="../qt_and_c++/sequential_containers.html">
            
                    
                    顺序容器（Sequential Containers）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4.3" data-path="../qt_and_c++/associative_containers.html">
            
                <a href="../qt_and_c++/associative_containers.html">
            
                    
                    组合容器（Associative Containers）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4.4" data-path="../qt_and_c++/file_io.html">
            
                <a href="../qt_and_c++/file_io.html">
            
                    
                    文件IO（File IO）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16.5" data-path="../qt_and_c++/models_in_c++.html">
            
                <a href="../qt_and_c++/models_in_c++.html">
            
                    
                    C++数据模型（Models in C++）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.5.1" data-path="../qt_and_c++/a_simple_model.html">
            
                <a href="../qt_and_c++/a_simple_model.html">
            
                    
                    一个简单的模型（A simple model）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5.2" data-path="../qt_and_c++/more_complex_data.html">
            
                <a href="../qt_and_c++/more_complex_data.html">
            
                    
                    更复杂的数据（More Complex Data）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5.3" data-path="../qt_and_c++/dynamic_data.html">
            
                <a href="../qt_and_c++/dynamic_data.html">
            
                    
                    动态数据（Dynamic Data）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5.4" data-path="../qt_and_c++/advanced_techniques.html">
            
                <a href="../qt_and_c++/advanced_techniques.html">
            
                    
                    进阶技巧（Advanced Techniques）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../extending_qml_with_c++/">
            
                <a href="../extending_qml_with_c++/">
            
                    
                    C++扩展QML（Extending QML with C++）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../extending_qml_with_c++/understanding_the_qml_run-time.html">
            
                <a href="../extending_qml_with_c++/understanding_the_qml_run-time.html">
            
                    
                    理解QML运行环境（Understanding the QML Run-time）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../extending_qml_with_c++/plugin_content.html">
            
                <a href="../extending_qml_with_c++/plugin_content.html">
            
                    
                    插件内容（Plugin Content）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.3" data-path="../extending_qml_with_c++/creating_the_plugin.html">
            
                <a href="../extending_qml_with_c++/creating_the_plugin.html">
            
                    
                    创建插件（Creating the plugin）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.4" data-path="../extending_qml_with_c++/fileio_implementation.html">
            
                <a href="../extending_qml_with_c++/fileio_implementation.html">
            
                    
                    FileIO实现（FileIO Implementation）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5" data-path="../extending_qml_with_c++/using_fileio.html">
            
                <a href="../extending_qml_with_c++/using_fileio.html">
            
                    
                    使用FileIO（Using FileIO）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.5.1" data-path="../extending_qml_with_c++/the_application_window.html">
            
                <a href="../extending_qml_with_c++/the_application_window.html">
            
                    
                    应用程序窗口（The Application Window）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5.2" data-path="../extending_qml_with_c++/using_actions.html">
            
                <a href="../extending_qml_with_c++/using_actions.html">
            
                    
                    使用动作（Using Actions）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5.3" data-path="../extending_qml_with_c++/formatting_the_table.html">
            
                <a href="../extending_qml_with_c++/formatting_the_table.html">
            
                    
                    格式化表格（Formatting the Table）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5.4" data-path="../extending_qml_with_c++/reading_data.html">
            
                <a href="../extending_qml_with_c++/reading_data.html">
            
                    
                    读取数据（Reading Data）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5.5" data-path="../extending_qml_with_c++/writing_data.html">
            
                <a href="../extending_qml_with_c++/writing_data.html">
            
                    
                    写入数据（Writing Data）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5.6" data-path="../extending_qml_with_c++/finishing_touch.html">
            
                <a href="../extending_qml_with_c++/finishing_touch.html">
            
                    
                    收尾工作（Finishing Touch）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17.6" data-path="../extending_qml_with_c++/summary.html">
            
                <a href="../extending_qml_with_c++/summary.html">
            
                    
                    总结（Summary）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../other/">
            
                <a href="../other/">
            
                    
                    其它（Other）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" data-path="../other/assets.html">
            
                <a href="../other/assets.html">
            
                    
                    示例源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.2" data-path="../other/enginsh_to_chinses.html">
            
                <a href="../other/enginsh_to_chinses.html">
            
                    
                    术语英汉对照表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.3" data-path="../other/book_format.html">
            
                <a href="../other/book_format.html">
            
                    
                    格式定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.4" data-path="../other/collaboration_correction.html">
            
                <a href="../other/collaboration_correction.html">
            
                    
                    协作校正
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >动画（Animations）</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x52A8;&#x753B;&#xFF08;animations&#xFF09;">&#x52A8;&#x753B;&#xFF08;Animations&#xFF09;</h1>
<p>&#x52A8;&#x753B;&#x88AB;&#x7528;&#x4E8E;&#x5C5E;&#x6027;&#x7684;&#x6539;&#x53D8;&#x3002;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x5B9A;&#x4E49;&#x4E86;&#x5C5E;&#x6027;&#x503C;&#x6539;&#x53D8;&#x7684;&#x66F2;&#x7EBF;&#xFF0C;&#x5C06;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x503C;&#x53D8;&#x5316;&#x4ECE;&#x4E00;&#x4E2A;&#x503C;&#x8FC7;&#x6E21;&#x5230;&#x53E6;&#x4E00;&#x4E2A;&#x503C;&#x3002;&#x52A8;&#x753B;&#x662F;&#x7531;&#x4E00;&#x8FDE;&#x4E32;&#x7684;&#x76EE;&#x6807;&#x5C5E;&#x6027;&#x6D3B;&#x52A8;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x5E73;&#x7F13;&#x7684;&#x66F2;&#x7EBF;&#x7B97;&#x6CD5;&#x80FD;&#x591F;&#x5F15;&#x53D1;&#x4E00;&#x4E2A;&#x5B9A;&#x4E49;&#x65F6;&#x95F4;&#x5185;&#x5C5E;&#x6027;&#x7684;&#x6301;&#x7EED;&#x53D8;&#x5316;&#x3002;&#x6240;&#x6709;&#x5728;QtQuick&#x4E2D;&#x7684;&#x52A8;&#x753B;&#x90FD;&#x7531;&#x540C;&#x4E00;&#x4E2A;&#x8BA1;&#x65F6;&#x5668;&#x6765;&#x63A7;&#x5236;&#xFF0C;&#x56E0;&#x6B64;&#x5B83;&#x4EEC;&#x59CB;&#x7EC8;&#x90FD;&#x4FDD;&#x6301;&#x540C;&#x6B65;&#xFF0C;&#x8FD9;&#x4E5F;&#x63D0;&#x9AD8;&#x4E86;&#x52A8;&#x753B;&#x7684;&#x6027;&#x80FD;&#x548C;&#x663E;&#x793A;&#x6548;&#x679C;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<p><strong>&#x52A8;&#x753B;&#x63A7;&#x5236;&#x4E86;&#x5C5E;&#x6027;&#x7684;&#x6539;&#x53D8;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x503C;&#x7684;&#x63D2;&#x5165;&#x3002;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x57FA;&#x672C;&#x7684;&#x6982;&#x5FF5;&#xFF0C;QML&#x662F;&#x57FA;&#x4E8E;&#x5143;&#x7D20;&#xFF0C;&#x5C5E;&#x6027;&#x4E0E;&#x811A;&#x672C;&#x7684;&#x3002;&#x6BCF;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x90FD;&#x63D0;&#x4F9B;&#x4E86;&#x8BB8;&#x591A;&#x7684;&#x5C5E;&#x6027;&#xFF0C;&#x6BCF;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x90FD;&#x5728;&#x7B49;&#x5F85;&#x4F7F;&#x7528;&#x52A8;&#x753B;&#x3002;&#x5728;&#x8FD9;&#x672C;&#x4E66;&#x4E2D;&#x4F60;&#x5C06;&#x4F1A;&#x770B;&#x5230;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x58EE;&#x9614;&#x7684;&#x573A;&#x666F;&#xFF0C;&#x4F60;&#x4F1A;&#x53D1;&#x73B0;&#x4F60;&#x81EA;&#x5DF1;&#x5728;&#x770B;&#x4E00;&#x4E9B;&#x52A8;&#x753B;&#x65F6;&#x6B23;&#x8D4F;&#x5B83;&#x4EEC;&#x7684;&#x7F8E;&#x4E3D;&#x5E76;&#x4E14;&#x80AF;&#x5B9A;&#x81EA;&#x5DF1;&#x7684;&#x521B;&#x9020;&#x6027;&#x60F3;&#x6CD5;&#x3002;&#x7136;&#x540E;&#x8BF7;&#x8BB0;&#x4F4F;&#xFF1A;&#x52A8;&#x753B;&#x63A7;&#x5236;&#x4E86;&#x5C5E;&#x6027;&#x7684;&#x6539;&#x53D8;&#xFF0C;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x90FD;&#x6709;&#x5927;&#x91CF;&#x7684;&#x5C5E;&#x6027;&#x4F9B;&#x4F60;&#x4EFB;&#x610F;&#x4F7F;&#x7528;&#x3002;</strong></p>
<p><img src="http://qmlbook.org/_images/animation.png" alt=""></p>
<pre><code>// animation.qml

import QtQuick 2.0

Image {
    source: &quot;assets/background.png&quot;

    Image {
        x: 40; y: 80
        source: &quot;assets/rocket.png&quot;

        NumberAnimation on x {
            to: 240
            duration: 4000
            loops: Animation.Infinite
        }
        RotationAnimation on rotation {
            to: 360
            duration: 4000
            loops: Animation.Infinite
        }
    }
}
</code></pre><p>&#x4E0A;&#x9762;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x5728;x&#x5750;&#x6807;&#x548C;&#x65CB;&#x8F6C;&#x5C5E;&#x6027;&#x4E0A;&#x5E94;&#x7528;&#x4E86;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x52A8;&#x753B;&#x3002;&#x6BCF;&#x4E00;&#x6B21;&#x52A8;&#x753B;&#x6301;&#x7EED;4000&#x6BEB;&#x79D2;&#x5E76;&#x4E14;&#x6C38;&#x4E45;&#x5FAA;&#x73AF;&#x3002;x&#x8F74;&#x5750;&#x6807;&#x52A8;&#x753B;&#x5C55;&#x793A;&#x4E86;&#x706B;&#x7BAD;&#x7684;x&#x5750;&#x6807;&#x9010;&#x6E10;&#x79FB;&#x81F3;240&#xFF0C;&#x65CB;&#x8F6C;&#x52A8;&#x753B;&#x5C55;&#x793A;&#x4E86;&#x5F53;&#x524D;&#x89D2;&#x5EA6;&#x5230;360&#x5EA6;&#x7684;&#x65CB;&#x8F6C;&#x3002;&#x4E24;&#x4E2A;&#x52A8;&#x753B;&#x540C;&#x65F6;&#x8FD0;&#x884C;&#xFF0C;&#x5E76;&#x4E14;&#x5728;&#x52A0;&#x8F7D;&#x7528;&#x6237;&#x754C;&#x9762;&#x5B8C;&#x6210;&#x540E;&#x5F00;&#x59CB;&#x3002;</p>
<p>&#x73B0;&#x5728;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;to&#x5C5E;&#x6027;&#x548C;duration&#x5C5E;&#x6027;&#x6765;&#x5B9E;&#x73B0;&#x52A8;&#x753B;&#x6548;&#x679C;&#x3002;&#x6216;&#x8005;&#x4F60;&#x53EF;&#x4EE5;&#x5728;opacity&#x6216;&#x8005;scale&#x4E0A;&#x6DFB;&#x52A0;&#x52A8;&#x753B;&#x4F5C;&#x4E3A;&#x4F8B;&#x5B50;&#xFF0C;&#x96C6;&#x6210;&#x8FD9;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x706B;&#x7BAD;&#x9010;&#x6E10;&#x6D88;&#x5931;&#x5728;&#x592A;&#x7A7A;&#x4E2D;&#xFF0C;&#x8BD5;&#x8BD5;&#x5427;!</p>
<h2 id="511-&#x52A8;&#x753B;&#x5143;&#x7D20;&#xFF08;animation-elements&#xFF09;">5.1.1 &#x52A8;&#x753B;&#x5143;&#x7D20;&#xFF08;Animation Elements&#xFF09;</h2>
<p>&#x6709;&#x51E0;&#x79CD;&#x7C7B;&#x578B;&#x7684;&#x52A8;&#x753B;&#xFF0C;&#x6BCF;&#x4E00;&#x79CD;&#x90FD;&#x5728;&#x7279;&#x5B9A;&#x60C5;&#x51B5;&#x4E0B;&#x90FD;&#x6709;&#x6700;&#x4F73;&#x7684;&#x6548;&#x679C;&#xFF0C;&#x4E0B;&#x9762;&#x5217;&#x51FA;&#x4E86;&#x4E00;&#x4E9B;&#x5E38;&#x7528;&#x7684;&#x52A8;&#x753B;&#xFF1A;</p>
<ul>
<li><p>PropertyAnimation&#xFF08;&#x5C5E;&#x6027;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;&#x5C5E;&#x6027;&#x503C;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>NumberAnimation&#xFF08;&#x6570;&#x5B57;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;&#x6570;&#x5B57;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>ColorAnimation&#xFF08;&#x989C;&#x8272;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;&#x989C;&#x8272;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>RotationAnimation&#xFF08;&#x65CB;&#x8F6C;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;&#x65CB;&#x8F6C;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
</ul>
<p>&#x9664;&#x4E86;&#x4E0A;&#x9762;&#x8FD9;&#x4E9B;&#x57FA;&#x672C;&#x548C;&#x901A;&#x5E38;&#x4F7F;&#x7528;&#x7684;&#x52A8;&#x753B;&#x5143;&#x7D20;&#xFF0C;QtQuick&#x8FD8;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x5207;&#x7279;&#x6B8A;&#x573A;&#x666F;&#x4E0B;&#x4F7F;&#x7528;&#x7684;&#x52A8;&#x753B;&#xFF1A;</p>
<ul>
<li><p>PauseAnimation&#xFF08;&#x505C;&#x6B62;&#x52A8;&#x753B;&#xFF09;- &#x8FD0;&#x884C;&#x6682;&#x505C;&#x4E00;&#x4E2A;&#x52A8;&#x753B;</p>
</li>
<li><p>SequentialAnimation&#xFF08;&#x987A;&#x5E8F;&#x52A8;&#x753B;&#xFF09;- &#x5141;&#x8BB8;&#x52A8;&#x753B;&#x6709;&#x5E8F;&#x64AD;&#x653E;</p>
</li>
<li><p>ParallelAnimation&#xFF08;&#x5E76;&#x884C;&#x52A8;&#x753B;&#xFF09;- &#x5141;&#x8BB8;&#x52A8;&#x753B;&#x540C;&#x65F6;&#x64AD;&#x653E;</p>
</li>
<li><p>AnchorAnimation&#xFF08;&#x951A;&#x5B9A;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;&#x951A;&#x5B9A;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>ParentAnimation&#xFF08;&#x7236;&#x5143;&#x7D20;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;&#x7236;&#x5BF9;&#x8C61;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>SmotthedAnimation&#xFF08;&#x5E73;&#x6ED1;&#x52A8;&#x753B;&#xFF09;- &#x8DDF;&#x8E2A;&#x4E00;&#x4E2A;&#x5E73;&#x6ED1;&#x503C;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>SpringAnimation&#xFF08;&#x5F39;&#x7C27;&#x52A8;&#x753B;&#xFF09;- &#x8DDF;&#x8E2A;&#x4E00;&#x4E2A;&#x5F39;&#x7C27;&#x53D8;&#x6362;&#x7684;&#x503C;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>PathAnimation&#xFF08;&#x8DEF;&#x5F84;&#x52A8;&#x753B;&#xFF09;- &#x8DDF;&#x8E2A;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x5BF9;&#x8C61;&#x7684;&#x8DEF;&#x5F84;&#x7684;&#x52A8;&#x753B;</p>
</li>
<li><p>Vector3dAnimation&#xFF08;3D&#x5BB9;&#x5668;&#x52A8;&#x753B;&#xFF09;- &#x4F7F;&#x7528;QVector3d&#x503C;&#x6539;&#x53D8;&#x64AD;&#x653E;&#x7684;&#x52A8;&#x753B;</p>
</li>
</ul>
<p>&#x6211;&#x4EEC;&#x5C06;&#x5728;&#x540E;&#x9762;&#x5B66;&#x4E60;&#x600E;&#x6837;&#x521B;&#x5EFA;&#x4E00;&#x8FDE;&#x4E32;&#x7684;&#x52A8;&#x753B;&#x3002;&#x5F53;&#x4F7F;&#x7528;&#x66F4;&#x52A0;&#x590D;&#x6742;&#x7684;&#x52A8;&#x753B;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x5728;&#x64AD;&#x653E;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x65F6;&#x4E2D;&#x6539;&#x53D8;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x6216;&#x8005;&#x8FD0;&#x884C;&#x4E00;&#x4E2A;&#x811A;&#x672C;&#x3002;&#x5BF9;&#x4E8E;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;QtQuick&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x52A8;&#x4F5C;&#x5143;&#x7D20;&#xFF1A;</p>
<ul>
<li><p>PropertyAction&#xFF08;&#x5C5E;&#x6027;&#x52A8;&#x4F5C;&#xFF09;- &#x5728;&#x64AD;&#x653E;&#x52A8;&#x753B;&#x65F6;&#x6539;&#x53D8;&#x5C5E;&#x6027;</p>
</li>
<li><p>ScriptAction&#xFF08;&#x811A;&#x672C;&#x52A8;&#x4F5C;&#xFF09;- &#x5728;&#x64AD;&#x653E;&#x52A8;&#x753B;&#x65F6;&#x8FD0;&#x884C;&#x811A;&#x672C;</p>
</li>
</ul>
<p>&#x5728;&#x8FD9;&#x4E00;&#x7AE0;&#x4E2D;&#x6211;&#x4EEC;&#x5C06;&#x4F1A;&#x4F7F;&#x7528;&#x4E00;&#x4E9B;&#x5C0F;&#x7684;&#x4F8B;&#x5B50;&#x6765;&#x8BA8;&#x8BBA;&#x5927;&#x591A;&#x6570;&#x7C7B;&#x578B;&#x7684;&#x52A8;&#x753B;&#x3002;</p>
<h2 id="512-&#x5E94;&#x7528;&#x52A8;&#x753B;&#xFF08;applying-animations&#xFF09;">5.1.2 &#x5E94;&#x7528;&#x52A8;&#x753B;&#xFF08;Applying Animations&#xFF09;</h2>
<p>&#x52A8;&#x753B;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x51E0;&#x79CD;&#x65B9;&#x5F0F;&#x6765;&#x5E94;&#x7528;&#xFF1A;</p>
<ul>
<li><p>&#x5C5E;&#x6027;&#x52A8;&#x753B; - &#x5728;&#x5143;&#x7D20;&#x5B8C;&#x6574;&#x52A0;&#x8F7D;&#x540E;&#x81EA;&#x52A8;&#x8FD0;&#x884C;</p>
</li>
<li><p>&#x5C5E;&#x6027;&#x52A8;&#x4F5C; - &#x5F53;&#x5C5E;&#x6027;&#x503C;&#x6539;&#x53D8;&#x65F6;&#x81EA;&#x52A8;&#x8FD0;&#x884C;</p>
</li>
<li><p>&#x72EC;&#x7ACB;&#x8FD0;&#x884C;&#x52A8;&#x753B; - &#x4F7F;&#x7528;start()&#x51FD;&#x6570;&#x660E;&#x786E;&#x6307;&#x5B9A;&#x8FD0;&#x884C;&#x6216;&#x8005;running&#x5C5E;&#x6027;&#x88AB;&#x8BBE;&#x7F6E;&#x4E3A;true&#xFF08;&#x6BD4;&#x5982;&#x901A;&#x8FC7;&#x5C5E;&#x6027;&#x7ED1;&#x5B9A;&#xFF09;</p>
</li>
</ul>
<p>&#x540E;&#x9762;&#x6211;&#x4EEC;&#x4F1A;&#x8C08;&#x8BBA;&#x5982;&#x4F55;&#x5728;&#x72B6;&#x6001;&#x53D8;&#x6362;&#x65F6;&#x64AD;&#x653E;&#x52A8;&#x753B;&#x3002;</p>
<p><strong>&#x6269;&#x5C55;&#x53EF;&#x70B9;&#x51FB;&#x56FE;&#x50CF;&#x5143;&#x7D20;&#x7248;&#x672C;2&#xFF08;ClickableImage Version2&#xFF09;</strong></p>
<p>&#x4E3A;&#x4E86;&#x6F14;&#x793A;&#x52A8;&#x753B;&#x7684;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#xFF0C;&#x6211;&#x4EEC;&#x91CD;&#x65B0;&#x5B9E;&#x73B0;&#x4E86;ClickableImage&#x7EC4;&#x4EF6;&#x5E76;&#x4E14;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E2A;&#x6587;&#x672C;&#x5143;&#x7D20;&#xFF08;Text Element&#xFF09;&#x6765;&#x6269;&#x5C55;&#x5B83;&#x3002;</p>
<pre><code>// ClickableImageV2.qml
// Simple image which can be clicked

import QtQuick 2.0

Item {
    id: root
    width: container.childrenRect.width
    height: container.childrenRect.height
    property alias text: label.text
    property alias source: image.source
    signal clicked

    Column {
        id: container
        Image {
            id: image
        }
        Text {
            id: label
            width: image.width
            horizontalAlignment: Text.AlignHCenter
            wrapMode: Text.WordWrap
            color: &quot;#111111&quot;
        }
    }

    MouseArea {
        anchors.fill: parent
        onClicked: root.clicked()
    }
}
</code></pre><p>&#x4E3A;&#x4E86;&#x7ED9;&#x56FE;&#x7247;&#x4E0B;&#x9762;&#x7684;&#x5143;&#x7D20;&#x5B9A;&#x4F4D;&#xFF0C;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E86;Column&#xFF08;&#x5217;&#xFF09;&#x5B9A;&#x4F4D;&#x5668;&#xFF0C;&#x5E76;&#x4E14;&#x4F7F;&#x7528;&#x57FA;&#x4E8E;&#x5217;&#x7684;&#x5B50;&#x77E9;&#x5F62;&#xFF08;childRect&#xFF09;&#x5C5E;&#x6027;&#x6765;&#x8BA1;&#x7B97;&#x5B83;&#x7684;&#x5BBD;&#x5EA6;&#x548C;&#x9AD8;&#x5EA6;&#xFF08;width and height&#xFF09;&#x3002;&#x6211;&#x4EEC;&#x5BFC;&#x51FA;&#x4E86;&#x6587;&#x672C;&#xFF08;text&#xFF09;&#x548C;&#x56FE;&#x5F62;&#x6E90;&#xFF08;source&#xFF09;&#x5C5E;&#x6027;&#xFF0C;&#x4E00;&#x4E2A;&#x70B9;&#x51FB;&#x4FE1;&#x53F7;&#xFF08;clicked signal&#xFF09;&#x3002;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x6587;&#x672C;&#x5143;&#x7D20;&#x7684;wrapMode&#x5C5E;&#x6027;&#x6765;&#x8BBE;&#x7F6E;&#x6587;&#x672C;&#x4E0E;&#x56FE;&#x50CF;&#x4E00;&#x6837;&#x5BBD;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x6362;&#x884C;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<p><strong>&#x7531;&#x4E8E;&#x51E0;&#x4F55;&#x4F9D;&#x8D56;&#x5173;&#x7CFB;&#x7684;&#x53CD;&#x5411;&#xFF08;&#x7236;&#x51E0;&#x4F55;&#x5BF9;&#x8C61;&#x4F9D;&#x8D56;&#x4E8E;&#x5B50;&#x51E0;&#x4F55;&#x5BF9;&#x8C61;&#xFF09;&#x6211;&#x4EEC;&#x4E0D;&#x80FD;&#x5BF9;ClickableImageV2&#x8BBE;&#x7F6E;&#x5BBD;&#x5EA6;/&#x9AD8;&#x5EA6;&#xFF08;width/height&#xFF09;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x6837;&#x5C06;&#x4F1A;&#x7834;&#x574F;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x505A;&#x597D;&#x7684;&#x5C5E;&#x6027;&#x7ED1;&#x5B9A;&#x3002;&#x8FD9;&#x662F;&#x6211;&#x4EEC;&#x5185;&#x90E8;&#x8BBE;&#x8BA1;&#x7684;&#x9650;&#x5236;&#xFF0C;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x8BBE;&#x8BA1;&#x7EC4;&#x4EF6;&#x7684;&#x4EBA;&#x4F60;&#x9700;&#x8981;&#x660E;&#x767D;&#x8FD9;&#x4E00;&#x70B9;&#x3002;&#x901A;&#x5E38;&#x6211;&#x4EEC;&#x66F4;&#x559C;&#x6B22;&#x5185;&#x90E8;&#x51E0;&#x4F55;&#x56FE;&#x50CF;&#x4F9D;&#x8D56;&#x4E8E;&#x7236;&#x51E0;&#x4F55;&#x5BF9;&#x8C61;&#x3002;</strong></p>
<p><img src="http://qmlbook.org/_images/animationtypes_start.png" alt=""></p>
<p>&#x4E09;&#x4E2A;&#x706B;&#x7BAD;&#x4F4D;&#x4E8E;&#x76F8;&#x540C;&#x7684;y&#x8F74;&#x5750;&#x6807;&#xFF08;y = 200&#xFF09;&#x3002;&#x5B83;&#x4EEC;&#x90FD;&#x9700;&#x8981;&#x79FB;&#x52A8;&#x5230;y = 40&#x3002;&#x6BCF;&#x4E00;&#x4E2A;&#x706B;&#x7BAD;&#x90FD;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x79CD;&#x7684;&#x65B9;&#x6CD5;&#x6765;&#x5B8C;&#x6210;&#x8FD9;&#x4E2A;&#x529F;&#x80FD;&#x3002;</p>
<pre><code>    ClickableImageV3 {
        id: rocket1
        x: 40; y: 200
        source: &quot;assets/rocket2.png&quot;
        text: &quot;animation on property&quot;
        NumberAnimation on y {
            to: 40; duration: 4000
        }
    }
</code></pre><p><strong>&#x7B2C;&#x4E00;&#x4E2A;&#x706B;&#x7BAD;</strong></p>
<p>&#x7B2C;&#x4E00;&#x4E2A;&#x706B;&#x7BAD;&#x4F7F;&#x7528;&#x4E86;Animation on <property>&#x5C5E;&#x6027;&#x53D8;&#x5316;&#x7684;&#x7B56;&#x7565;&#x6765;&#x5B8C;&#x6210;&#x3002;&#x52A8;&#x753B;&#x4F1A;&#x5728;&#x52A0;&#x8F7D;&#x5B8C;&#x6210;&#x540E;&#x7ACB;&#x5373;&#x64AD;&#x653E;&#x3002;&#x70B9;&#x51FB;&#x706B;&#x7BAD;&#x53EF;&#x4EE5;&#x91CD;&#x7F6E;&#x5B83;&#x56DE;&#x5230;&#x5F00;&#x59CB;&#x7684;&#x4F4D;&#x7F6E;&#x3002;&#x5728;&#x52A8;&#x753B;&#x64AD;&#x653E;&#x65F6;&#x91CD;&#x7F6E;&#x7B2C;&#x4E00;&#x4E2A;&#x706B;&#x7BAD;&#x4E0D;&#x4F1A;&#x6709;&#x4EFB;&#x4F55;&#x5F71;&#x54CD;&#x3002;&#x5728;&#x52A8;&#x753B;&#x5F00;&#x59CB;&#x524D;&#x7684;&#x51E0;&#x5206;&#x4E4B;&#x4E00;&#x79D2;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x65B0;&#x7684;y&#x8F74;&#x5750;&#x6807;&#x8BA9;&#x4EBA;&#x611F;&#x89C9;&#x633A;&#x4E0D;&#x5B89;&#x5168;&#x7684;&#xFF0C;&#x5E94;&#x5F53;&#x907F;&#x514D;&#x8FD9;&#x6837;&#x7684;&#x5C5E;&#x6027;&#x503C;&#x7ADE;&#x4E89;&#x7684;&#x53D8;&#x5316;&#x3002;</property></p>
<pre><code>    ClickableImageV3 {
        id: rocket2
        x: 152; y: 200
        source: &quot;assets/rocket2.png&quot;
        text: &quot;behavior on property&quot;
        Behavior on y {
            NumberAnimation { duration: 4000 }
        }

        onClicked: y = 40
        // random y on each click
    //        onClicked: y = 40+Math.random()*(205-40)
    }
</code></pre><p><strong>&#x7B2C;&#x4E8C;&#x4E2A;&#x706B;&#x7BAD;</strong></p>
<p>&#x7B2C;&#x4E8C;&#x4E2A;&#x706B;&#x7BAD;&#x4F7F;&#x7528;&#x4E86;behavior on <property>&#x5C5E;&#x6027;&#x884C;&#x4E3A;&#x7B56;&#x7565;&#x7684;&#x52A8;&#x753B;&#x3002;&#x8FD9;&#x4E2A;&#x884C;&#x4E3A;&#x544A;&#x8BC9;&#x5C5E;&#x6027;&#x503C;&#x6BCF;&#x65F6;&#x6BCF;&#x523B;&#x90FD;&#x5728;&#x53D8;&#x5316;&#xFF0C;&#x901A;&#x8FC7;&#x52A8;&#x753B;&#x7684;&#x65B9;&#x5F0F;&#x6765;&#x6539;&#x53D8;&#x8FD9;&#x4E2A;&#x503C;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x884C;&#x4E3A;&#x5143;&#x7D20;&#x7684;enabled : false&#x6765;&#x8BBE;&#x7F6E;&#x884C;&#x4E3A;&#x5931;&#x6548;&#x3002;&#x5F53;&#x4F60;&#x70B9;&#x51FB;&#x8FD9;&#x4E2A;&#x706B;&#x7BAD;&#x65F6;&#x5B83;&#x5C06;&#x4F1A;&#x5F00;&#x59CB;&#x8FD0;&#x884C;&#xFF08;y&#x8F74;&#x5750;&#x6807;&#x9010;&#x6E10;&#x79FB;&#x81F3;40&#xFF09;&#x3002;&#x7136;&#x540E;&#x5176;&#x5B83;&#x7684;&#x70B9;&#x51FB;&#x5BF9;&#x4E8E;&#x4F4D;&#x7F6E;&#x7684;&#x6539;&#x53D8;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x7684;&#x5F71;&#x54CD;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x8BD5;&#x7740;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x968F;&#x673A;&#x503C;&#xFF08;&#x4F8B;&#x5982; 40+(Math.random()*(205-40)&#xFF09;&#x6765;&#x8BBE;&#x7F6E;y&#x8F74;&#x5750;&#x6807;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#x52A8;&#x753B;&#x59CB;&#x7EC8;&#x4F1A;&#x5C06;&#x79FB;&#x52A8;&#x5230;&#x65B0;&#x4F4D;&#x7F6E;&#x7684;&#x65F6;&#x95F4;&#x5339;&#x914D;&#x5728;4&#x79D2;&#x5185;&#x5B8C;&#x6210;&#x3002;</property></p>
<pre><code>    ClickableImageV3 {
        id: rocket3
        x: 264; y: 200
        source: &quot;assets/rocket2.png&quot;
        onClicked: anim.start()
    //        onClicked: anim.restart()

        text: &quot;standalone animation&quot;

        NumberAnimation {
            id: anim
            target: rocket3
            properties: &quot;y&quot;
            from: 205
            to: 40
            duration: 4000
        }
    }
</code></pre><p><strong>&#x7B2C;&#x4E09;&#x4E2A;&#x706B;&#x7BAD;</strong></p>
<p>&#x7B2C;&#x4E09;&#x4E2A;&#x706B;&#x7BAD;&#x4F7F;&#x7528;standalone animation&#x72EC;&#x7ACB;&#x52A8;&#x753B;&#x7B56;&#x7565;&#x3002;&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x7531;&#x4E00;&#x4E2A;&#x79C1;&#x6709;&#x7684;&#x5143;&#x7D20;&#x5B9A;&#x4E49;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x5199;&#x5728;&#x6587;&#x6863;&#x7684;&#x4EFB;&#x4F55;&#x5730;&#x65B9;&#x3002;&#x70B9;&#x51FB;&#x706B;&#x7BAD;&#x8C03;&#x7528;&#x52A8;&#x753B;&#x51FD;&#x6570;start()&#x6765;&#x542F;&#x52A8;&#x52A8;&#x753B;&#x3002;&#x6BCF;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x90FD;&#x6709;start()&#xFF0C;stop()&#xFF0C;resume()&#xFF0C;restart()&#x51FD;&#x6570;&#x3002;&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x81EA;&#x8EAB;&#x53EF;&#x4EE5;&#x6BD4;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x7684;&#x52A8;&#x753B;&#x66F4;&#x65E9;&#x7684;&#x83B7;&#x53D6;&#x5230;&#x66F4;&#x591A;&#x7684;&#x76F8;&#x5173;&#x4FE1;&#x606F;&#x3002;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x5B9A;&#x4E49;&#x76EE;&#x6807;&#x548C;&#x76EE;&#x6807;&#x5143;&#x7D20;&#x7684;&#x5C5E;&#x6027;&#x9700;&#x8981;&#x600E;&#x6837;&#x6539;&#x53D8;&#x7684;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x3002;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;to&#x5C5E;&#x6027;&#x7684;&#x503C;&#xFF0C;&#x5728;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E2D;&#x6211;&#x4EEC;&#x4E5F;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;from&#x5C5E;&#x6027;&#x7684;&#x503C;&#x5141;&#x8BB8;&#x52A8;&#x753B;&#x53EF;&#x4EE5;&#x91CD;&#x590D;&#x8FD0;&#x884C;&#x3002;</p>
<p><img src="http://qmlbook.org/_images/animationtypes.png" alt=""></p>
<p>&#x70B9;&#x51FB;&#x80CC;&#x666F;&#x80FD;&#x591F;&#x91CD;&#x65B0;&#x8BBE;&#x7F6E;&#x6240;&#x6709;&#x7684;&#x706B;&#x7BAD;&#x56DE;&#x5230;&#x5B83;&#x4EEC;&#x7684;&#x521D;&#x59CB;&#x4F4D;&#x7F6E;&#x3002;&#x7B2C;&#x4E00;&#x4E2A;&#x706B;&#x7BAD;&#x65E0;&#x6CD5;&#x88AB;&#x91CD;&#x7F6E;&#xFF0C;&#x53EA;&#x6709;&#x91CD;&#x542F;&#x7A0B;&#x5E8F;&#x91CD;&#x65B0;&#x52A0;&#x8F7D;&#x5143;&#x7D20;&#x624D;&#x80FD;&#x91CD;&#x7F6E;&#x5B83;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<p><strong>&#x53E6;&#x4E00;&#x4E2A;&#x542F;&#x52A8;/&#x505C;&#x6B62;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x7684;&#x65B9;&#x6CD5;&#x662F;&#x7ED1;&#x5B9A;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x7684;running&#x5C5E;&#x6027;&#x3002;&#x5F53;&#x9700;&#x8981;&#x7528;&#x6237;&#x8F93;&#x5165;&#x63A7;&#x5236;&#x5C5E;&#x6027;&#x65F6;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x975E;&#x5E38;&#x6709;&#x7528;&#xFF1A;</strong></p>
<pre><code>    NumberAnimation {
        ...
        // animation runs when mouse is pressed
        running: area.pressed
    }
    MouseArea {
        id: area
    }
</code></pre><h2 id="513-&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#xFF08;easing-curves&#xFF09;">5.1.3 &#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#xFF08;Easing Curves&#xFF09;</h2>
<p>&#x5C5E;&#x6027;&#x503C;&#x7684;&#x6539;&#x53D8;&#x80FD;&#x591F;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x6765;&#x63A7;&#x5236;&#xFF0C;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x5C5E;&#x6027;&#x5F71;&#x54CD;&#x4E86;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x503C;&#x6539;&#x53D8;&#x7684;&#x63D2;&#x503C;&#x7B97;&#x6CD5;&#x3002;&#x6211;&#x4EEC;&#x73B0;&#x5728;&#x5DF2;&#x7ECF;&#x5B9A;&#x4E49;&#x7684;&#x52A8;&#x753B;&#x90FD;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x79CD;&#x7EBF;&#x6027;&#x7684;&#x63D2;&#x503C;&#x7B97;&#x6CD5;&#xFF0C;&#x56E0;&#x4E3A;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x7684;&#x9ED8;&#x8BA4;&#x7F13;&#x51B2;&#x7C7B;&#x578B;&#x662F;Easing.Linear&#x3002;&#x5728;&#x4E00;&#x4E2A;&#x5C0F;&#x573A;&#x666F;&#x4E0B;&#x7684;x&#x8F74;&#x4E0E;y&#x8F74;&#x5750;&#x6807;&#x6539;&#x53D8;&#x53EF;&#x4EE5;&#x5F97;&#x5230;&#x6700;&#x597D;&#x7684;&#x89C6;&#x89C9;&#x6548;&#x679C;&#x3002;&#x4E00;&#x4E2A;&#x7EBF;&#x6027;&#x63D2;&#x503C;&#x7B97;&#x6CD5;&#x5C06;&#x4F1A;&#x5728;&#x52A8;&#x753B;&#x5F00;&#x59CB;&#x65F6;&#x4F7F;&#x7528;from&#x7684;&#x503C;&#x5230;&#x52A8;&#x753B;&#x7ED3;&#x675F;&#x65F6;&#x4F7F;&#x7528;&#x7684;to&#x503C;&#x7ED8;&#x5236;&#x4E00;&#x6761;&#x76F4;&#x7EBF;&#xFF0C;&#x6240;&#x4EE5;&#x7F13;&#x51B2;&#x7C7B;&#x578B;&#x5B9A;&#x4E49;&#x4E86;&#x66F2;&#x7EBF;&#x7684;&#x53D8;&#x5316;&#x60C5;&#x51B5;&#x3002;&#x7CBE;&#x5FC3;&#x4E3A;&#x4E00;&#x4E2A;&#x79FB;&#x52A8;&#x7684;&#x5BF9;&#x8C61;&#x6311;&#x9009;&#x4E00;&#x4E2A;&#x5408;&#x9002;&#x7684;&#x7F13;&#x51B2;&#x7C7B;&#x578B;&#x5C06;&#x4F1A;&#x4F7F;&#x754C;&#x9762;&#x66F4;&#x52A0;&#x81EA;&#x7136;&#xFF0C;&#x4F8B;&#x5982;&#x4E00;&#x4E2A;&#x9875;&#x9762;&#x7684;&#x6ED1;&#x51FA;&#xFF0C;&#x6700;&#x521D;&#x4F7F;&#x7528;&#x7F13;&#x6162;&#x7684;&#x901F;&#x5EA6;&#x6ED1;&#x51FA;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6700;&#x540E;&#x6ED1;&#x51FA;&#x65F6;&#x4F7F;&#x7528;&#x9AD8;&#x901F;&#x6ED1;&#x51FA;&#xFF0C;&#x7C7B;&#x4F3C;&#x7FFB;&#x4E66;&#x4E00;&#x6837;&#x7684;&#x6548;&#x679C;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<p><strong>&#x4E0D;&#x8981;&#x8FC7;&#x5EA6;&#x7684;&#x4F7F;&#x7528;&#x52A8;&#x753B;&#x3002;&#x7528;&#x6237;&#x754C;&#x9762;&#x52A8;&#x753B;&#x7684;&#x8BBE;&#x8BA1;&#x5E94;&#x8BE5;&#x5C3D;&#x91CF;&#x5C0F;&#x5FC3;&#xFF0C;&#x52A8;&#x753B;&#x662F;&#x8BA9;&#x754C;&#x9762;&#x66F4;&#x52A0;&#x751F;&#x52A8;&#x800C;&#x4E0D;&#x662F;&#x5145;&#x6EE1;&#x6574;&#x4E2A;&#x754C;&#x9762;&#x3002;&#x773C;&#x775B;&#x5BF9;&#x4E8E;&#x79FB;&#x52A8;&#x7684;&#x4E1C;&#x897F;&#x975E;&#x5E38;&#x654F;&#x611F;&#xFF0C;&#x5F88;&#x5BB9;&#x6613;&#x5E72;&#x6270;&#x7528;&#x6237;&#x7684;&#x4F7F;&#x7528;&#x3002;</strong></p>
<p>&#x5728;&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#x6211;&#x4EEC;&#x5C06;&#x4F1A;&#x4F7F;&#x7528;&#x4E0D;&#x540C;&#x7684;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#xFF0C;&#x6BCF;&#x4E00;&#x79CD;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x90FD;&#x90FD;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E2A;&#x53EF;&#x70B9;&#x51FB;&#x56FE;&#x7247;&#x6765;&#x5C55;&#x793A;&#xFF0C;&#x70B9;&#x51FB;&#x5C06;&#x4F1A;&#x5728;&#x52A8;&#x753B;&#x4E2D;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7F13;&#x51B2;&#x7C7B;&#x578B;&#x5E76;&#x4E14;&#x4F7F;&#x7528;&#x8FD9;&#x79CD;&#x66F2;&#x7EBF;&#x91CD;&#x65B0;&#x542F;&#x52A8;&#x52A8;&#x753B;&#x3002;</p>
<p><img src="http://qmlbook.org/_images/easingtypes.png" alt=""></p>
<p><strong>&#x6269;&#x5C55;&#x53EF;&#x70B9;&#x51FB;&#x56FE;&#x50CF;V3&#xFF08;ClickableImage V3&#xFF09;</strong></p>
<p>&#x6211;&#x4EEC;&#x7ED9;&#x56FE;&#x7247;&#x548C;&#x6587;&#x672C;&#x6DFB;&#x52A0;&#x4E86;&#x4E00;&#x4E2A;&#x5C0F;&#x7684;&#x5916;&#x6846;&#x6765;&#x589E;&#x5F3A;&#x6211;&#x4EEC;&#x7684;ClickableImage&#x3002;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;property bool framed: false&#x6765;&#x4F5C;&#x4E3A;&#x6211;&#x4EEC;&#x7684;API&#xFF0C;&#x57FA;&#x4E8E;framed&#x7684;&#x503C;&#x6211;&#x4EEC;&#x80FD;&#x591F;&#x8BBE;&#x7F6E;&#x8FD9;&#x4E2A;&#x6846;&#x662F;&#x5426;&#x53EF;&#x89C1;&#xFF0C;&#x5E76;&#x4E14;&#x4E0D;&#x7834;&#x574F;&#x4E4B;&#x524D;&#x7528;&#x6237;&#x7684;&#x4F7F;&#x7528;&#x3002;&#x4E0B;&#x9762;&#x662F;&#x6211;&#x4EEC;&#x505A;&#x7684;&#x4FEE;&#x6539;&#x3002;</p>
<pre><code>// ClickableImageV2.qml
// Simple image which can be clicked

import QtQuick 2.0

Item {
    id: root
    width: container.childrenRect.width + 16
    height: container.childrenRect.height + 16
    property alias text: label.text
    property alias source: image.source
    signal clicked

    // M1&gt;&gt;
    // ... add a framed rectangle as container
    property bool framed : false

    Rectangle {
        anchors.fill: parent
        color: &quot;white&quot;
        visible: root.framed
    }
</code></pre><p>&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x7684;&#x4EE3;&#x7801;&#x975E;&#x5E38;&#x7B80;&#x6D01;&#x3002;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x8FDE;&#x4E32;&#x7684;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x7684;&#x540D;&#x79F0;&#xFF08;property variant easings&#xFF09;&#x5E76;&#x4E14;&#x5728;&#x4E00;&#x4E2A;Repeater&#xFF08;&#x91CD;&#x590D;&#x5143;&#x7D20;&#xFF09;&#x4E2D;&#x5C06;&#x5B83;&#x4EEC;&#x5206;&#x914D;&#x7ED9;&#x4E00;&#x4E2A;ClickableImage&#x3002;&#x56FE;&#x7247;&#x7684;&#x6E90;&#x8DEF;&#x5F84;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x65B9;&#x6848;&#x6765;&#x5B9A;&#x4E49;&#xFF0C;&#x4E00;&#x4E2A;&#x53EB;&#x505A;&#x201C;InQuad&#x201D;&#x7684;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x5728;&#x201C;curves/InQuad.png&#x201D;&#x4E2D;&#x6709;&#x4E00;&#x4E2A;&#x5BF9;&#x5E94;&#x7684;&#x56FE;&#x7247;&#x3002;&#x5982;&#x679C;&#x4F60;&#x70B9;&#x51FB;&#x4E00;&#x4E2A;&#x66F2;&#x7EBF;&#x56FE;&#xFF0C;&#x8FD9;&#x4E2A;&#x70B9;&#x51FB;&#x5C06;&#x4F1A;&#x5206;&#x914D;&#x4E00;&#x4E2A;&#x7F13;&#x51B2;&#x7C7B;&#x578B;&#x7ED9;&#x52A8;&#x753B;&#x7136;&#x540E;&#x91CD;&#x65B0;&#x542F;&#x52A8;&#x52A8;&#x753B;&#x3002;&#x52A8;&#x753B;&#x81EA;&#x8EAB;&#x662F;&#x7528;&#x6765;&#x8BBE;&#x7F6E;&#x65B9;&#x5757;&#x7684;x&#x5750;&#x6807;&#x5C5E;&#x6027;&#x5728;2&#x79D2;&#x5185;&#x53D8;&#x5316;&#x7684;&#x72EC;&#x7ACB;&#x52A8;&#x753B;&#x3002;</p>
<pre><code>// easingtypes.qml

import QtQuick 2.0

DarkSquare {
    id: root
    width: 600
    height: 340

    // A list of easing types
    property variant easings : [
        &quot;Linear&quot;, &quot;InQuad&quot;, &quot;OutQuad&quot;, &quot;InOutQuad&quot;,
        &quot;InCubic&quot;, &quot;InSine&quot;, &quot;InCirc&quot;, &quot;InElastic&quot;,
        &quot;InBack&quot;, &quot;InBounce&quot; ]


    Grid {
        id: container
        anchors.top: parent.top
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.margins: 16
        height: 200
        columns: 5
        spacing: 16
        // iterates over the &apos;easings&apos; list
        Repeater {
            model: easings
            ClickableImageV3 {
                framed: true
                // the current data entry from &apos;easings&apos; list
                text: modelData
                source: &quot;curves/&quot; + modelData + &quot;.png&quot;
                onClicked: {
                    // set the easing type on the animation
                    anim.easing.type = modelData
                    // restart the animation
                    anim.restart()
                }
            }
        }
    }

    // The square to be animated
    GreenSquare {
        id: square
        x: 40; y: 260
    }

    // The animation to test the easing types
    NumberAnimation {
        id: anim
        target: square
        from: 40; to: root.width - 40 - square.width
        properties: &quot;x&quot;
        duration: 2000
    }
}
</code></pre><p>&#x5F53;&#x4F60;&#x8FD0;&#x884C;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x65F6;&#xFF0C;&#x8BF7;&#x6CE8;&#x610F;&#x89C2;&#x5BDF;&#x52A8;&#x753B;&#x7684;&#x6539;&#x53D8;&#x901F;&#x5EA6;&#x3002;&#x4E00;&#x4E9B;&#x52A8;&#x753B;&#x5BF9;&#x4E8E;&#x8FD9;&#x4E2A;&#x5BF9;&#x8C61;&#x770B;&#x8D77;&#x6765;&#x5F88;&#x81EA;&#x7136;&#xFF0C;&#x4E00;&#x4E9B;&#x770B;&#x8D77;&#x6765;&#x975E;&#x5E38;&#x607C;&#x706B;&#x3002;</p>
<p>&#x9664;&#x4E86;duration&#x5C5E;&#x6027;&#x4E0E;easing.type&#x5C5E;&#x6027;&#xFF0C;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x5BF9;&#x52A8;&#x753B;&#x8FDB;&#x884C;&#x5FAE;&#x8C03;&#x3002;&#x4F8B;&#x5982;PropertyAnimation&#x5C5E;&#x6027;&#xFF0C;&#x5927;&#x591A;&#x6570;&#x52A8;&#x753B;&#x90FD;&#x652F;&#x6301;&#x9644;&#x52A0;&#x7684;easing.amplitude&#xFF08;&#x7F13;&#x51B2;&#x632F;&#x5E45;&#xFF09;&#xFF0C;easing.overshoot&#xFF08;&#x7F13;&#x51B2;&#x6EA2;&#x51FA;&#xFF09;&#xFF0C;easing.period&#xFF08;&#x7F13;&#x51B2;&#x5468;&#x671F;&#xFF09;&#xFF0C;&#x8FD9;&#x4E9B;&#x5C5E;&#x6027;&#x5141;&#x8BB8;&#x4F60;&#x5BF9;&#x4E2A;&#x522B;&#x7684;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x8FDB;&#x884C;&#x5FAE;&#x8C03;&#x3002;&#x4E0D;&#x662F;&#x6240;&#x6709;&#x7684;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x90FD;&#x652F;&#x6301;&#x8FD9;&#x4E9B;&#x53C2;&#x6570;&#x3002;&#x53EF;&#x4EE5;&#x67E5;&#x770B;Qt PropertyAnimation&#x6587;&#x6863;&#x4E2D;&#x7684;&#x7F13;&#x51B2;&#x5217;&#x8868;&#xFF08;easing table&#xFF09;&#x6765;&#x67E5;&#x770B;&#x4E00;&#x4E2A;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x7684;&#x76F8;&#x5173;&#x53C2;&#x6570;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<p><strong>&#x5BF9;&#x4E8E;&#x7528;&#x6237;&#x754C;&#x9762;&#x6B63;&#x786E;&#x7684;&#x52A8;&#x753B;&#x975E;&#x5E38;&#x91CD;&#x8981;&#x3002;&#x8BF7;&#x8BB0;&#x4F4F;&#x52A8;&#x753B;&#x662F;&#x5E2E;&#x52A9;&#x7528;&#x6237;&#x754C;&#x9762;&#x66F4;&#x52A0;&#x751F;&#x52A8;&#x800C;&#x4E0D;&#x662F;&#x523A;&#x6FC0;&#x7528;&#x6237;&#x7684;&#x773C;&#x775B;&#x3002;</strong></p>
<h2 id="514-&#x52A8;&#x753B;&#x5206;&#x7EC4;&#xFF08;grouped-animations&#xFF09;">5.1.4 &#x52A8;&#x753B;&#x5206;&#x7EC4;&#xFF08;Grouped Animations&#xFF09;</h2>
<p>&#x901A;&#x5E38;&#x4F7F;&#x7528;&#x7684;&#x52A8;&#x753B;&#x6BD4;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x7684;&#x52A8;&#x753B;&#x66F4;&#x52A0;&#x590D;&#x6742;&#x3002;&#x4F8B;&#x5982;&#x4F60;&#x60F3;&#x540C;&#x65F6;&#x8FD0;&#x884C;&#x51E0;&#x4E2A;&#x52A8;&#x753B;&#x5E76;&#x628A;&#x4ED6;&#x4EEC;&#x8FDE;&#x63A5;&#x8D77;&#x6765;&#xFF0C;&#x6216;&#x8005;&#x5728;&#x4E00;&#x4E2A;&#x4E00;&#x4E2A;&#x7684;&#x8FD0;&#x884C;&#xFF0C;&#x6216;&#x8005;&#x5728;&#x4E24;&#x4E2A;&#x52A8;&#x753B;&#x4E4B;&#x95F4;&#x6267;&#x884C;&#x4E00;&#x4E2A;&#x811A;&#x672C;&#x3002;&#x52A8;&#x753B;&#x5206;&#x7EC4;&#x63D0;&#x4F9B;&#x4E86;&#x5F88;&#x597D;&#x7684;&#x5E2E;&#x52A9;&#xFF0C;&#x4F5C;&#x4E3A;&#x547D;&#x540D;&#x5EFA;&#x8BAE;&#x53EF;&#x4EE5;&#x53EB;&#x505A;&#x4E00;&#x7EC4;&#x52A8;&#x753B;&#x3002;&#x6709;&#x4E24;&#x79CD;&#x65B9;&#x6CD5;&#x6765;&#x5206;&#x7EC4;&#xFF1A;&#x5E73;&#x884C;&#x4E0E;&#x8FDE;&#x7EED;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;SequentialAnimation&#xFF08;&#x8FDE;&#x7EED;&#x52A8;&#x753B;&#xFF09;&#x548C;ParallelAnimation&#xFF08;&#x5E73;&#x884C;&#x52A8;&#x753B;&#xFF09;&#x6765;&#x5B9E;&#x73B0;&#x5B83;&#x4EEC;&#xFF0C;&#x5B83;&#x4EEC;&#x4F5C;&#x4E3A;&#x52A8;&#x753B;&#x7684;&#x5BB9;&#x5668;&#x6765;&#x5305;&#x542B;&#x5176;&#x5B83;&#x7684;&#x52A8;&#x753B;&#x5143;&#x7D20;&#x3002;</p>
<p><img src="http://qmlbook.org/_images/groupedanimation.png" alt=""></p>
<p>&#x5F53;&#x5F00;&#x59CB;&#x65F6;&#xFF0C;&#x5E73;&#x884C;&#x5143;&#x7D20;&#x7684;&#x6240;&#x6709;&#x5B50;&#x52A8;&#x753B;&#x90FD;&#x4F1A;&#x5E73;&#x884C;&#x8FD0;&#x884C;&#xFF0C;&#x5B83;&#x5141;&#x8BB8;&#x4F60;&#x5728;&#x540C;&#x4E00;&#x65F6;&#x95F4;&#x4F7F;&#x7528;&#x4E0D;&#x540C;&#x7684;&#x5C5E;&#x6027;&#x6765;&#x64AD;&#x653E;&#x52A8;&#x753B;&#x3002;</p>
<pre><code>// parallelanimation.qml
import QtQuick 2.0

BrightSquare {
    id: root
    width: 300
    height: 200
    property int duration: 3000

    ClickableImageV3 {
        id: rocket
        x: 20; y: 120
        source: &quot;assets/rocket2.png&quot;
        onClicked: anim.restart()
    }

    ParallelAnimation {
        id: anim
        NumberAnimation {
            target: rocket
            properties: &quot;y&quot;
            to: 20
            duration: root.duration
        }
        NumberAnimation {
            target: rocket
            properties: &quot;x&quot;
            to: 160
            duration: root.duration
        }
    }
}
</code></pre><p><img src="http://qmlbook.org/_images/parallelanimation_sequence.png" alt=""></p>
<p>&#x4E00;&#x4E2A;&#x8FDE;&#x7EED;&#x7684;&#x52A8;&#x753B;&#x5C06;&#x4F1A;&#x4E00;&#x4E2A;&#x4E00;&#x4E2A;&#x7684;&#x8FD0;&#x884C;&#x5B50;&#x52A8;&#x753B;&#x3002;</p>
<pre><code>// sequentialanimation.qml
import QtQuick 2.0

BrightSquare {
    id: root
    width: 300
    height: 200
    property int duration: 3000

    ClickableImageV3 {
        id: rocket
        x: 20; y: 120
        source: &quot;assets/rocket2.png&quot;
        onClicked: anim.restart()
    }

    SequentialAnimation {
        id: anim
        NumberAnimation {
            target: rocket
            properties: &quot;y&quot;
            to: 20
            // 60% of time to travel up
            duration: root.duration*0.6
        }
        NumberAnimation {
            target: rocket
            properties: &quot;x&quot;
            to: 160
            // 40% of time to travel sideways
            duration: root.duration*0.4
        }
    }
}
</code></pre><p><img src="http://qmlbook.org/_images/sequentialanimation_sequence.png" alt=""></p>
<p>&#x5206;&#x7EC4;&#x52A8;&#x753B;&#x4E5F;&#x53EF;&#x4EE5;&#x88AB;&#x5D4C;&#x5957;&#xFF0C;&#x4F8B;&#x5982;&#x4E00;&#x4E2A;&#x8FDE;&#x7EED;&#x52A8;&#x753B;&#x53EF;&#x4EE5;&#x62E5;&#x6709;&#x4E24;&#x4E2A;&#x5E73;&#x884C;&#x52A8;&#x753B;&#x4F5C;&#x4E3A;&#x5B50;&#x52A8;&#x753B;&#x3002;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x770B;&#x8FD9;&#x4E2A;&#x8DB3;&#x7403;&#x7684;&#x4F8B;&#x5B50;&#x3002;&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x63CF;&#x8FF0;&#x4E86;&#x4E00;&#x4E2A;&#x4ECE;&#x5DE6;&#x5411;&#x53F3;&#x6254;&#x4E00;&#x4E2A;&#x7403;&#x7684;&#x884C;&#x4E3A;&#xFF1A;</p>
<p><img src="http://qmlbook.org/_images/soccer_init.png" alt=""></p>
<p>&#x8981;&#x5F04;&#x660E;&#x767D;&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5256;&#x6790;&#x8FD9;&#x4E2A;&#x76EE;&#x6807;&#x7684;&#x8FD0;&#x52A8;&#x8FC7;&#x7A0B;&#x3002;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x8BB0;&#x4F4F;&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x662F;&#x901A;&#x8FC7;&#x5C5E;&#x6027;&#x53D8;&#x5316;&#x6765;&#x5B9E;&#x73B0;&#x7684;&#x52A8;&#x753B;&#xFF0C;&#x4E0B;&#x9762;&#x662F;&#x4E0D;&#x540C;&#x90E8;&#x5206;&#x7684;&#x8F6C;&#x6362;&#xFF1A;</p>
<ul>
<li><p>&#x4ECE;&#x5DE6;&#x5411;&#x53F3;&#x7684;x&#x5750;&#x6807;&#x8F6C;&#x6362;&#xFF08;X1&#xFF09;&#x3002;</p>
</li>
<li><p>&#x4ECE;&#x4E0B;&#x5F80;&#x4E0A;&#x7684;y&#x5750;&#x6807;&#x8F6C;&#x6362;&#xFF08;Y1&#xFF09;&#x7136;&#x540E;&#x8DDF;&#x7740;&#x4E00;&#x4E2A;&#x4ECE;&#x4E0A;&#x5F80;&#x4E0B;&#x7684;Y&#x5750;&#x6807;&#x8F6C;&#x6362;&#xFF08;Y2&#xFF09;&#x3002;</p>
</li>
<li><p>&#x6574;&#x4E2A;&#x52A8;&#x753B;&#x8FC7;&#x7A0B;&#x4E2D;360&#x5EA6;&#x65CB;&#x8F6C;&#x3002;</p>
</li>
</ul>
<p>&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x5C06;&#x4F1A;&#x82B1;&#x6389;3&#x79D2;&#x949F;&#x7684;&#x65F6;&#x95F4;&#x3002;</p>
<p><img src="http://qmlbook.org/_images/soccer_plan.png" alt=""></p>
<p>&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x7A7A;&#x7684;&#x57FA;&#x672C;&#x5143;&#x7D20;&#x5BF9;&#x8C61;&#xFF08;Item&#xFF09;&#x4F5C;&#x4E3A;&#x6839;&#x5143;&#x7D20;&#xFF0C;&#x5B83;&#x7684;&#x5BBD;&#x5EA6;&#x4E3A;480&#xFF0C;&#x9AD8;&#x5EA6;&#x4E3A;300&#x3002;</p>
<pre><code>import QtQuick 1.1

Item {
    id: root
    width: 480
    height: 300
    property int duration: 3000

    ...
}
</code></pre><p>&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x52A8;&#x753B;&#x7684;&#x603B;&#x6301;&#x7EED;&#x65F6;&#x95F4;&#x4F5C;&#x4E3A;&#x53C2;&#x8003;&#xFF0C;&#x4EE5;&#x4FBF;&#x66F4;&#x597D;&#x7684;&#x540C;&#x6B65;&#x5404;&#x90E8;&#x5206;&#x7684;&#x52A8;&#x753B;&#x3002;</p>
<p>&#x4E0B;&#x4E00;&#x6B65;&#x6211;&#x4EEC;&#x9700;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x80CC;&#x666F;&#xFF0C;&#x5728;&#x6211;&#x4EEC;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E2D;&#x6709;&#x4E24;&#x4E2A;&#x77E9;&#x5F62;&#x6846;&#x5206;&#x522B;&#x4F7F;&#x7528;&#x4E86;&#x7EFF;&#x8272;&#x6E10;&#x53D8;&#x548C;&#x84DD;&#x8272;&#x6E10;&#x53D8;&#x586B;&#x5145;&#x3002;</p>
<pre><code>    Rectangle {
        id: sky
        width: parent.width
        height: 200
        gradient: Gradient {
            GradientStop { position: 0.0; color: &quot;#0080FF&quot; }
            GradientStop { position: 1.0; color: &quot;#66CCFF&quot; }
        }
    }
    Rectangle {
        id: ground
        anchors.top: sky.bottom
        anchors.bottom: root.bottom
        width: parent.width
        gradient: Gradient {
            GradientStop { position: 0.0; color: &quot;#00FF00&quot; }
            GradientStop { position: 1.0; color: &quot;#00803F&quot; }
        }
    }
</code></pre><p><img src="http://qmlbook.org/_images/soccer_stage1.png" alt=""></p>
<p>&#x4E0A;&#x9762;&#x90E8;&#x5206;&#x7684;&#x84DD;&#x8272;&#x533A;&#x57DF;&#x9AD8;&#x5EA6;&#x4E3A;200&#x50CF;&#x7D20;&#xFF0C;&#x4E0B;&#x9762;&#x90E8;&#x5206;&#x7684;&#x533A;&#x57DF;&#x4F7F;&#x7528;&#x4E0A;&#x9762;&#x7684;&#x84DD;&#x8272;&#x533A;&#x57DF;&#x7684;&#x5E95;&#x4F5C;&#x4E3A;&#x951A;&#x5B9A;&#x7684;&#x9876;&#xFF0C;&#x4F7F;&#x7528;&#x6839;&#x5143;&#x7D20;&#x7684;&#x5E95;&#x4F5C;&#x4E3A;&#x5E95;&#x3002;</p>
<p>&#x8BA9;&#x6211;&#x4EEC;&#x5C06;&#x8DB3;&#x7403;&#x52A0;&#x5165;&#x5230;&#x5C4F;&#x5E55;&#x4E0A;&#xFF0C;&#x8DB3;&#x7403;&#x662F;&#x4E00;&#x4E2A;&#x56FE;&#x7247;&#xFF0C;&#x4F4D;&#x4E8E;&#x8DEF;&#x5F84;&#x201C;assets/soccer_ball.png&#x201D;&#x3002;&#x9996;&#x5148;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5C06;&#x5B83;&#x653E;&#x7F6E;&#x5728;&#x5DE6;&#x4E0B;&#x89D2;&#x63A5;&#x8FD1;&#x8FB9;&#x754C;&#x5904;&#x3002;</p>
<pre><code>    Image {
        id: ball
        x: 20; y: 240
        source: &quot;assets/soccer_ball.png&quot;

        MouseArea {
            anchors.fill: parent
            onClicked: {
                ball.x = 20; ball.y = 240
                anim.restart()
            }
        }
    }
</code></pre><p><img src="http://qmlbook.org/_images/soccer_stage2.png" alt=""></p>
<p>&#x56FE;&#x7247;&#x4E0E;&#x9F20;&#x6807;&#x533A;&#x57DF;&#x8FDE;&#x63A5;&#xFF0C;&#x70B9;&#x51FB;&#x7403;&#x5C06;&#x4F1A;&#x91CD;&#x7F6E;&#x7403;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x5E76;&#x4E14;&#x52A8;&#x753B;&#x91CD;&#x65B0;&#x5F00;&#x59CB;&#x3002;</p>
<p>&#x9996;&#x5148;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x8FDE;&#x7EED;&#x7684;&#x52A8;&#x753B;&#x6765;&#x64AD;&#x653E;&#x4E24;&#x6B21;&#x7684;y&#x8F74;&#x53D8;&#x6362;&#x3002;</p>
<pre><code>    SequentialAnimation {
        id: anim
        NumberAnimation {
            target: ball
            properties: &quot;y&quot;
            to: 20
            duration: root.duration * 0.4
        }
        NumberAnimation {
            target: ball
            properties: &quot;y&quot;
            to: 240
            duration: root.duration * 0.6
        }
    }
</code></pre><p><img src="http://qmlbook.org/_images/soccer_stage3.png" alt=""></p>
<p>&#x5728;&#x52A8;&#x753B;&#x603B;&#x65F6;&#x95F4;&#x7684;40%&#x7684;&#x65F6;&#x95F4;&#x91CC;&#x5B8C;&#x6210;&#x4E0A;&#x5347;&#x90E8;&#x5206;&#xFF0C;&#x5728;&#x52A8;&#x753B;&#x603B;&#x65F6;&#x95F4;&#x7684;60%&#x7684;&#x65F6;&#x95F4;&#x91CC;&#x5B8C;&#x6210;&#x4E0B;&#x964D;&#x90E8;&#x5206;&#xFF0C;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x5B8C;&#x6210;&#x540E;&#x64AD;&#x653E;&#x4E0B;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x3002;&#x76EE;&#x524D;&#x8FD8;&#x6CA1;&#x6709;&#x4F7F;&#x7528;&#x4EFB;&#x4F55;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x3002;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x5C06;&#x5728;&#x540E;&#x9762;&#x4F7F;&#x7528;easing curves&#x6765;&#x6DFB;&#x52A0;&#xFF0C;&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x53EA;&#x5173;&#x5FC3;&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x52A8;&#x753B;&#x6765;&#x5B8C;&#x6210;&#x8FC7;&#x6E21;&#x3002;</p>
<p>&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x6DFB;&#x52A0;x&#x8F74;&#x5750;&#x6807;&#x8F6C;&#x6362;&#x3002;x&#x8F74;&#x5750;&#x6807;&#x8F6C;&#x6362;&#x9700;&#x8981;&#x4E0E;y&#x8F74;&#x5750;&#x6807;&#x8F6C;&#x6362;&#x540C;&#x65F6;&#x8FDB;&#x884C;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5C06;y&#x8F74;&#x5750;&#x6807;&#x8F6C;&#x6362;&#x7684;&#x8FDE;&#x7EED;&#x52A8;&#x753B;&#x548C;x&#x8F74;&#x5750;&#x6807;&#x8F6C;&#x6362;&#x4E00;&#x8D77;&#x538B;&#x7F29;&#x8FDB;&#x4E00;&#x4E2A;&#x5E73;&#x884C;&#x52A8;&#x753B;&#x4E2D;&#x3002;</p>
<pre><code>    ParallelAnimation {
        id: anim
        SequentialAnimation {
            // ... our Y1, Y2 animation
        }
        NumberAnimation { // X1 animation
            target: ball
            properties: &quot;x&quot;
            to: 400
            duration: root.duration
        }
    }
</code></pre><p><img src="http://qmlbook.org/_images/soccer_stage4.png" alt=""></p>
<p>&#x6700;&#x540E;&#x6211;&#x4EEC;&#x60F3;&#x8981;&#x65CB;&#x8F6C;&#x8FD9;&#x4E2A;&#x7403;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5411;&#x5E73;&#x884C;&#x52A8;&#x753B;&#x4E2D;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x52A8;&#x753B;&#xFF0C;&#x6211;&#x4EEC;&#x9009;&#x62E9;RotationAnimation&#x6765;&#x5B9E;&#x73B0;&#x65CB;&#x8F6C;&#x3002;</p>
<pre><code>    ParallelAnimation {
        id: anim
        SequentialAnimation {
            // ... our Y1, Y2 animation
        }
        NumberAnimation { // X1 animation
            // X1 animation
        }
        RotationAnimation {
            target: ball
            properties: &quot;rotation&quot;
            to: 720
            duration: root.duration
        }
    }
</code></pre><p>&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5B8C;&#x6210;&#x4E86;&#x6574;&#x4E2A;&#x52A8;&#x753B;&#x94FE;&#x8868;&#xFF0C;&#x7136;&#x540E;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7ED9;&#x52A8;&#x753B;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x6B63;&#x786E;&#x7684;&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#x6765;&#x63CF;&#x8FF0;&#x4E00;&#x4E2A;&#x79FB;&#x52A8;&#x7684;&#x7403;&#x3002;&#x5BF9;&#x4E8E;Y1&#x52A8;&#x753B;&#x6211;&#x4EEC;&#x4F7F;&#x7528;Easing.OutCirc&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#xFF0C;&#x5B83;&#x770B;&#x8D77;&#x6765;&#x66F4;&#x50CF;&#x662F;&#x4E00;&#x4E2A;&#x5706;&#x5468;&#x8FD0;&#x52A8;&#x3002;Y2&#x4F7F;&#x7528;&#x4E86;Easing.OutBounce&#x7F13;&#x51B2;&#x66F2;&#x7EBF;&#xFF0C;&#x56E0;&#x4E3A;&#x5728;&#x6700;&#x540E;&#x7403;&#x4F1A;&#x53D1;&#x751F;&#x53CD;&#x5F39;&#x3002;&#xFF08;&#x8BD5;&#x8BD5;&#x4F7F;&#x7528;Easing.InBounce&#xFF0C;&#x4F60;&#x4F1A;&#x53D1;&#x73B0;&#x53CD;&#x5F39;&#x5C06;&#x4F1A;&#x7ACB;&#x523B;&#x5F00;&#x59CB;&#x3002;&#xFF09;&#x3002;X1&#x548C;ROT1&#x52A8;&#x753B;&#x90FD;&#x4F7F;&#x7528;&#x7EBF;&#x6027;&#x66F2;&#x7EBF;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x662F;&#x8FD9;&#x4E2A;&#x52A8;&#x753B;&#x6700;&#x540E;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x63D0;&#x4F9B;&#x7ED9;&#x4F60;&#x4F5C;&#x4E3A;&#x53C2;&#x8003;&#xFF1A;</p>
<pre><code>    ParallelAnimation {
        id: anim
        SequentialAnimation {
            NumberAnimation {
                target: ball
                properties: &quot;y&quot;
                to: 20
                duration: root.duration * 0.4
                easing.type: Easing.OutCirc
            }
            NumberAnimation {
                target: ball
                properties: &quot;y&quot;
                to: 240
                duration: root.duration * 0.6
                easing.type: Easing.OutBounce
            }
        }
        NumberAnimation {
            target: ball
            properties: &quot;x&quot;
            to: 400
            duration: root.duration
        }
        RotationAnimation {
            target: ball
            properties: &quot;rotation&quot;
            to: 720
            duration: root.duration * 1.1
        }
    }
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: 动态元素（Fluid Elements）">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="states_and_transitions.html" class="navigation navigation-next " aria-label="Next page: 状态与过渡（States and Transitions）">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"动画（Animations）","level":"1.6.1","depth":2,"next":{"title":"状态与过渡（States and Transitions）","level":"1.6.2","depth":2,"path":"fluid_elements/states_and_transitions.md","ref":"fluid_elements/states_and_transitions.md","articles":[]},"previous":{"title":"动态元素（Fluid Elements）","level":"1.6","depth":1,"path":"fluid_elements/README.md","ref":"fluid_elements/README.md","articles":[{"title":"动画（Animations）","level":"1.6.1","depth":2,"path":"fluid_elements/animations.md","ref":"fluid_elements/animations.md","articles":[]},{"title":"状态与过渡（States and Transitions）","level":"1.6.2","depth":2,"path":"fluid_elements/states_and_transitions.md","ref":"fluid_elements/states_and_transitions.md","articles":[]},{"title":"高级用法（Advanced Techniques）","level":"1.6.3","depth":2,"path":"fluid_elements/advanced_techniques.md","ref":"fluid_elements/advanced_techniques.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"fluid_elements/animations.md","mtime":"2018-03-15T08:59:33.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-19T02:46:00.425Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

